package com.buymobile.service.impl;


import java.util.List;
import java.util.Map;

import com.buymobile.dao.CompanyDAO;
import com.buymobile.domain.Company;
import com.buymobile.service.CompanyService;

public class CompanyServiceImpl implements CompanyService {
	
	private CompanyDAO companyDAO;

	public void setCompanyDAO(CompanyDAO companyDAO) {
		this.companyDAO = companyDAO;
	}

	@Override
	public Company getByUserName(String userName) {
		return (Company)companyDAO.queryForObject("company.getByUserName",userName);
	}

	@Override
	public int findCount(Map map) {
		return (Integer) companyDAO.queryForObject("company.findCompanyCount",map);
	}

	@Override
	public List findList(Map map) {
		return companyDAO.queryForList("company.findCompanyList", map);
	}

	@Override
	public void save(Company company) {
		companyDAO.insert("company.saveCompany", company);
	}

	@Override
	public void update(Company company) {
		companyDAO.update("company.updateCompany", company);
	}

	@Override
	public Company get(Integer id) {
		return (Company)companyDAO.queryForObject("company.getCompany", id);
	}
	
	
}
